/**
 * @mbggenerated
 * @author wujian
 */
package bearworker.zxl.dao.mapper;

import bearworker.zxl.entity.ManagerSuppInfo;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;

import java.util.List;

public interface ManagerSuppInfoMapper {
    /* @mbggenerated */
    @Delete({
        "delete from manager_supp_info",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /* @mbggenerated */
    @Insert({
        "insert into manager_supp_info (id, supp_name, ",
        "supp_user_name, supp_user_wxid, ",
        "supp_charge_ratio, state, ",
        "create_user, create_time, ",
        "upd_user, update_time, ",
        "supp_address, supp_telephone)",
        "values (#{id,jdbcType=INTEGER}, #{suppName,jdbcType=VARCHAR}, ",
        "#{suppUserName,jdbcType=VARCHAR}, #{suppUserWxid,jdbcType=VARCHAR}, ",
        "#{suppChargeRatio,jdbcType=INTEGER}, #{state,jdbcType=TINYINT}, ",
        "#{createUser,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updUser,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, ",
        "#{suppAddress,jdbcType=VARCHAR}, #{suppTelephone,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys = true,keyProperty = "manager_supp_info.id")
    int insert(ManagerSuppInfo record);

    /* @mbggenerated */
    @InsertProvider(type=ManagerSuppInfoSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys = true,keyProperty = "manager_supp_info.id")
    int insertSelective(ManagerSuppInfo record);

    /* @mbggenerated */
    @Select({
        "select",
        "id, supp_name, supp_user_name, supp_user_wxid, supp_charge_ratio, state, create_user, ",
        "create_time, upd_user, update_time, supp_address, supp_telephone",
        "from manager_supp_info",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="supp_name", property="suppName", jdbcType=JdbcType.VARCHAR),
        @Result(column="supp_user_name", property="suppUserName", jdbcType=JdbcType.VARCHAR),
        @Result(column="supp_user_wxid", property="suppUserWxid", jdbcType=JdbcType.VARCHAR),
        @Result(column="supp_charge_ratio", property="suppChargeRatio", jdbcType=JdbcType.INTEGER),
        @Result(column="state", property="state", jdbcType=JdbcType.TINYINT),
        @Result(column="create_user", property="createUser", jdbcType=JdbcType.INTEGER),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="upd_user", property="updUser", jdbcType=JdbcType.INTEGER),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="supp_address", property="suppAddress", jdbcType=JdbcType.VARCHAR),
        @Result(column="supp_telephone", property="suppTelephone", jdbcType=JdbcType.VARCHAR)
    })
    ManagerSuppInfo selectByPrimaryKey(Integer id);

    /* @mbggenerated */
    @UpdateProvider(type=ManagerSuppInfoSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(ManagerSuppInfo record);

    /* @mbggenerated */
    @Update({
        "update manager_supp_info",
        "set supp_name = #{suppName,jdbcType=VARCHAR},",
          "supp_user_name = #{suppUserName,jdbcType=VARCHAR},",
          "supp_user_wxid = #{suppUserWxid,jdbcType=VARCHAR},",
          "supp_charge_ratio = #{suppChargeRatio,jdbcType=INTEGER},",
          "state = #{state,jdbcType=TINYINT},",
          "create_user = #{createUser,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "upd_user = #{updUser,jdbcType=INTEGER},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "supp_address = #{suppAddress,jdbcType=VARCHAR},",
          "supp_telephone = #{suppTelephone,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ManagerSuppInfo record);

    @Select({
            "select",
            "id, supp_name, supp_user_name, supp_user_wxid, supp_charge_ratio, state, create_user, ",
            "create_time, upd_user, update_time, supp_address, supp_telephone",
            "from manager_supp_info limit #{0,jdbcType=INTEGER},#{1,jdbcType=INTEGER}"
    })
    @Results({
            @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
            @Result(column="supp_name", property="suppName", jdbcType=JdbcType.VARCHAR),
            @Result(column="supp_user_name", property="suppUserName", jdbcType=JdbcType.VARCHAR),
            @Result(column="supp_user_wxid", property="suppUserWxid", jdbcType=JdbcType.VARCHAR),
            @Result(column="supp_charge_ratio", property="suppChargeRatio", jdbcType=JdbcType.INTEGER),
            @Result(column="state", property="state", jdbcType=JdbcType.TINYINT),
            @Result(column="create_user", property="createUser", jdbcType=JdbcType.INTEGER),
            @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="upd_user", property="updUser", jdbcType=JdbcType.INTEGER),
            @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="supp_address", property="suppAddress", jdbcType=JdbcType.VARCHAR),
            @Result(column="supp_telephone", property="suppTelephone", jdbcType=JdbcType.VARCHAR)
    })
    List<ManagerSuppInfo> getSuppList(int offset,int limit);

    @Select({
            "select",
            "count(id) from manager_supp_info"
    })
    int getSuppCnt();


    @Select({
            "select",
            "id, supp_name, supp_user_name, supp_user_wxid, supp_charge_ratio, state, create_user, ",
            "create_time, upd_user, update_time, supp_address, supp_telephone",
            "from manager_supp_info",
            "where supp_name = #{0,jdbcType=INTEGER}"
    })
    @Results({
            @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
            @Result(column="supp_name", property="suppName", jdbcType=JdbcType.VARCHAR),
            @Result(column="supp_user_name", property="suppUserName", jdbcType=JdbcType.VARCHAR),
            @Result(column="supp_user_wxid", property="suppUserWxid", jdbcType=JdbcType.VARCHAR),
            @Result(column="supp_charge_ratio", property="suppChargeRatio", jdbcType=JdbcType.INTEGER),
            @Result(column="state", property="state", jdbcType=JdbcType.TINYINT),
            @Result(column="create_user", property="createUser", jdbcType=JdbcType.INTEGER),
            @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="upd_user", property="updUser", jdbcType=JdbcType.INTEGER),
            @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
            @Result(column="supp_address", property="suppAddress", jdbcType=JdbcType.VARCHAR),
            @Result(column="supp_telephone", property="suppTelephone", jdbcType=JdbcType.VARCHAR)
    })
    ManagerSuppInfo getSuppInfoByName(String suppName);



}